<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="div"></div>
    <button id="btn1">按钮</button>
    <script>
        //DOM0级时间处理程序
        var btn1=document.getElementById("btn1");
        btn1.onclick=function(){
            alert("hello DOM0级事件处理程序");
        }
        //清楚事件
        /*btn1.onclick=null;*/
        //弊端,会被覆盖掉
        btn1.onclick=function () {
            alert("hello2 DOM0级事件处理程序");
        }

    </script>
</body>
</html>